/**
 *  Copyright 2016年12月10日 北京福富软件技术股份有限公司
 *  All Rights Reserved.
 *  文件名称: HandshakeInterceptor  
 *  初始作者：g.huangshg
 *  初始版本：V1.0.0   
 *  完成日期： 2016年12月10日 
 */
package com.controller;

import java.util.Map;

import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;


public class HandshakeInterceptor extends HttpSessionHandshakeInterceptor {

        @Override
        public boolean beforeHandshake(ServerHttpRequest request,
                                       ServerHttpResponse response, WebSocketHandler wsHandler,
                                       Map<String, Object> attributes) throws Exception {
            System.out.println("Before Handshake");
            return super.beforeHandshake(request, response, wsHandler, attributes);
        }

        @Override
        public void afterHandshake(ServerHttpRequest request,
                                   ServerHttpResponse response, WebSocketHandler wsHandler,
                                   Exception ex) {
            System.out.println("After Handshake");
            super.afterHandshake(request, response, wsHandler, ex);
        }

    }

